home *** CD-ROM | disk | FTP | other *** search
-
- 7. Using macros
-
-
-
- A macro is a set of actions associated with a keyboard
- accelerator (also called a keyboard shortcut or hot
- key). The macro facility in the HoTMetaL PRO Editor
- can be used to define your own macros. This is particularly
- useful when you have to carry out some repetitive task
- that doesn't have a built-in accelerator or command.
-
- You can save your macros in one or more files and load
- them as needed.
-
- Macros are not associated with a specific document,
- so any macros you load will be available for use with
- all documents that you edit.
-
- Macros can be associated with text and/or elements to
- be inserted in a document, a single command, or a complex
- series of commands. Some actions that you can perform
- with macros are:
-
- * Insert an element that doesn't have a toolbar button
- associated with it.
-
- * Set an attribute or property in several elements.
- For example, if you wanted to set the background color
- to `green' for several table cells that weren't in the
- same row or column, you could create a macro that set
- a cell's background to green, then navigate to each
- cell, re-running the macro each time. This would be
- faster than setting the background `manually' each time.
-
- * Insert a piece of text that is used repeatedly.
-
- * Create a keyboard shortcut for a command that doesn't
- have a built-in shortcut, subject to certainrestrictions.
-
-
- 7.1. Creating macros
-
- To record a macro:
-
- * Choose Record New Macro from the Tools menu or click
- on the {Run Macro} toolbar button. This starts macro
- recording. The command will then toggle to Stop Recording...
- and the status bar will read Recording macro.
-
- * Enter the sequence of actions that you want the macro
- to carry out. These actions will not only be recorded,
- they will also be applied to the current document as
- you perform them. There are some restrictions on what
- can go into a macro.
-
- * When you're finished, choose Stop Recording... in
- the Tools menu or click on the {Stop Recording} toolbar
- button. This command ends the macro.
-
- Now you will get a dialog box that lets you select a
- descriptive name and an accelerator for the macro. The
- accelerator is the sequence of keystrokes that will
- run the macro.
-
- An accelerator can consist of any choice from the Key
- list (a letter, number, function key, or arrow key),
- alone or preceded by [Ctrl], [Alt], or [ Shift] in any
- combination.
-
- * Enter a descriptive name for the macro.
-
- * Choose the keys for the accelerator.
-
- * Click on [New Macro].
-
- If you re-use one of HoTMetaL PRO's built-in keyboard
- accelerators as a macro accelerator, its original functionality
- will be unavailable as long as that macro is loaded.
-
-
- Restrictions on macros
-
- A macro should be self-contained, that is, its completion
- must not depend on any user input at the time the macro
- is run, such as typing in a dialog box or making a selection
- from a list. Therefore, there are some sequences of
- actions that cannot successfully be included in a macro.
- As a general guideline, if a macro involves any of the
- commands whose name ends in `...', that command should
- be completed somewhere in the macro. So, for example,
- you can define a macro that inserts a particular element,
- but you cannot define a macro that simply brings up
- the Insert Element dialog box.
-
- Mouse clicks in the document window are ignored during
- macro recording. The first time you attempt to use the
- mouse to change the selection, HoTMetaL PRO will beep.
- The second time, you will get a message saying that
- you should use the cursor (arrow) keys to change the
- selection.
-
- In general, a macro that was recorded in one of HoTMetaL
- PRO Editor's three views (WYSIWYG view, Tags On view,
- HTML Source view) should not be played back in the other
- two views.
-
- The following other actions cannot be recorded in macro:
-
- * Setting table properties.
-
- * The Check HTML and Check Accessibility commands.
-
- * Insertion of ActiveX controls and Design-Time Controls
- (DTCs).
-
- * Spell checking operations.
-
- If you use a toolbar button when recording a macro,
- note that even though a toolbar button can perform one
- of several actions (insert, change, split) only the
- action that was actually performed when you recorded
- the macro will be performed the next time you run the
- macro. For example, if the insertion point is inside
- a P element and you click on the {P} button, HoTMetaL
- PRO will split the P element. This action is recorded
- in a macro as `split the current element', so when the
- macro is run, it will attempt to split the current element,
- even if it's not a P. (By contrast, if you create markup
- with the Element... or Change Element... command, it
- will be played back in the macro exactly as you entered
- it.)
-
- 7.2. Running a macro
-
- The usual way to run a macro is to type its keyboard
- accelerator. You can also run macros by choosing Macros...
- from the Tools menu. This gives you a dialog box that
- lists all the macros that are currently available.
-
- To run a macro:
-
- * Choose Macros... from the Tools menu, or click on
- the {Run Macro} toolbar button. The Macros dialog appears.
-
- * Select the appropriate macro from the list.
-
- * Click on [Run] .
-
- You can run only one macro at a time.
-
- 7.3. Changing a macro accelerator
-
- To change the accelerator associated with a macro:
-
- * Choose Macros... from the Tools menu. The Macros dialog
- appears and displays a list of currently loaded macros.
-
- * Select the macro that you want to change.
-
- * Choose a new accelerator using the Ctrl, Alt, and
- Shift check boxes and the Key list.
-
- * Click on [Change].
-
- 7.4. Deleting a macro
-
- To delete a macro from the list of loaded macros:
-
- * Choose Macros... in the Tools menu. This displays
- a dialog box with a list of currently loaded macros.
-
- * Select the macro that you want to delete. (You can
- delete only one macro at a time.)
-
- * Click on [Delete].
-
- If you delete a macro that has been loaded from a file,
- the macro is removed only from the list of available
- macros--it is not deleted from the file from which it
- was loaded, and can subsequently be re-loaded.
-
- To delete a macro from a macro file:
-
- * Delete the macro from the list of loaded macros, as
- described above.
-
- * Click on [Save]. This saves the currently loaded macros
- to the file.
-
- 7.5. Saving and loading macro files
-
- To save the currently loaded macros to a file:
-
- * Choose Macros... from the Tools menu. This displays
- a dialog box with a list of currently loaded macros.
- The name of the current macro file (if there is one)
- is displayed at the bottom of the dialog box.
-
- * Click on [Save] to save the macros to the current
- macro file.
-
- * Click on [Save As...] to save the macros to another
- macro file.
-
- A macro file saved in this way can later be loaded
- by clicking on Load....
-
- If any macros are still unsaved when you attempt to
- exit HoTMetaL PRO, you will get a warning message informing
- you of this and giving you the opportunity to save the
- macros before exiting.
-
- To load a macro file:
-
- * Choose Macros... from the Tools menu.
-
- * Click on [Load...].
-
- * Choose a macro (.mcr) file.
-
- After a macro file is loaded, the previously loaded
- macros are unavailable. If any macros have been defined
- but not yet saved, these will be lost. Before the new
- macro file is loaded, you will receive a warning dialog
- giving you the opportunity to save any unsaved macros.
-
-
- When you load a macro file, it becomes the default macro
- file and will be loaded the next time you launch HoTMetaL
- PRO. The default macro file for HoTMetaL PRO is hmpro4.mcr,
- located in the macros folder under the HoTMetaL PRO
- folder. See the file readme.htm in this folder for more
- information.
-
-